<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
	<head>
		<base href="<%=basePath%>">
		<meta charset="utf-8">
		<title>小程序助手</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<!-- <link rel="stylesheet" href="static/mobile/css/mui.min.css"> -->
		<link rel="stylesheet" href="static/mobile/css/search.css">
	</head>

	<body>
		<header class="header">
		<form id="form" name="f" action="#" class="search-fm">
			<div class="search-icon"><input type="search" name="keywords" id="kw" value="" placeholder="输入小程序名称关键字" />
			<i onclick="search()"></i>
			</div>
			<div class="close" onclick="javascript:history.back(-1)"></div>
			</form>
		</header>
		<p class="search-result"></p>
		<div class="content">
			<ul class="miniapp-list-content">
			
			</ul>
		</div>
		
		<!--下拉刷新容器-->
		<!--<div id="pullrefresh" class="mui-content mui-scroll-wrapper">
			<div class="mui-scroll">-->
				<!--数据列表-->
				<!--<ul class="mui-table-view mui-table-view-chevron">
					
				</ul>
			</div>
		</div> -->
		<script src="static/miniApp/js/jquery-1.7.1.min.js" type="text/javascript"></script>
	  	<script type="text/javascript" src="static/miniApp/js/jquery.form.js"></script>
		<script>
			$(function(){
			    var key=sessionStorage.getItem("FH_SEARCH_KEY");
				$("#kw").val(key);
				var k=$("#kw").val();
				if(k != ""){
					search();
				}
			 });
			 
			form.onsubmit = function() {
   			  search();
   			 return false;
			};
			
			function search(){
				$("#kw").blur();
				$("#form").attr("action","app/mobileSearch");
			 	$("#form").ajaxForm().ajaxSubmit({
					  success:function(result) {
						 $(".miniapp-list-content").html(""); 				 		 
				 		 $(".miniapp-list-content").append(result); 
				 		 var totalCount=$("#totalCount").val();
				 		 var str="共为你找到"+totalCount+"款小程序";
				 		 $(".search-result").text(str);

					   },
					   error:function(XMLHttpRequest, textStatus,errorThrown) {
					  	 $(".miniapp-list-content").html(""); 
					  	  $(".search-result").text("");
						 return false;
					  }
				});
			}
			
			function jumpdetail(id){
				var key=$("#kw").val();
				sessionStorage.setItem("FH_SEARCH_KEY", key);
				window.location.href="<%=basePath%>/app/app_detail?ID=" + id;
			}

		</script>
		
		<iframe id="stat" style="display:none" src="static/weixin/ymstat.jsp"></iframe>
	</body>

</html>